home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Form & Validation / tell-a-friend.izs < prev    next >
Text File  |  2005-08-29  |  3KB  |  100 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Tell-a-friend script
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>Let visitors refer others to your webpage (via email) with this script! It asks for the friend's email address, then loads the email program with the essential information pre-filled to instantly send off.
  7. <!/DESCRIPTION> 
  8.  
  9. <!CATEGORY>form and form validation<!/CATEGORY>
  10.  
  11. <!SCRIPT>
  12. <!-- START OF SCRIPT -->
  13. <SCRIPT LANGUAGE="JavaScript">
  14. <!-- Begin
  15.  
  16. var initialsubj="Hay buddy, take a look at this"
  17. var initialmsg="Hi:\n You may want to check out this site: "+window.location
  18. var good;
  19. function checkEmailAddress(field) {
  20.  
  21. var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
  22. if (goodEmail) {
  23. good = true;
  24. }
  25. else {
  26. alert('Please enter a valid address.');
  27. field.focus();
  28. field.select();
  29. good = false;
  30.    }
  31. }
  32. u = window.location;
  33. function mailThisUrl() {
  34. good = false
  35. checkEmailAddress(document.eMailer.email);
  36. if (good) {
  37.  
  38. //window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u;
  39. window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg
  40.    }
  41. }
  42. //  End -->
  43. </script>
  44.  
  45.  
  46. <form name="eMailer">
  47. Tell a friend:
  48. <input type="text" name="email" size="26" value="     Enter Address Here" onFocus="this.value=''" onMouseOver="window.status='Enter email address here and tell a friend about this site...'; return true" onMouseOut="window.status='';return true">
  49. <br>
  50. <input type="button" value="Send this URL" onMouseOver="window.status='Click to send an email (with this page address) to a friend! Enter email address above...'; return true" onMouseOut="window.status='';return true" onClick="mailThisUrl();">
  51. </form>
  52. <!-- END OF SCRIPT -->
  53. <!/SCRIPT>
  54.  
  55. <!PREVIEW>
  56. <!-- START OF SCRIPT -->
  57.  
  58. <SCRIPT LANGUAGE="JavaScript">
  59. <!-- Begin
  60.  
  61. var initialsubj="Hay buddy, take a look at this"
  62. var initialmsg="Hi:\n You may want to check out this site: "+window.location
  63. var good;
  64. function checkEmailAddress(field) {
  65.  
  66. var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
  67. if (goodEmail) {
  68. good = true;
  69. }
  70. else {
  71. alert('Please enter a valid address.');
  72. field.focus();
  73. field.select();
  74. good = false;
  75.    }
  76. }
  77. u = window.location;
  78. function mailThisUrl() {
  79. good = false
  80. checkEmailAddress(document.eMailer.email);
  81. if (good) {
  82.  
  83. //window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u;
  84. window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg
  85.    }
  86. }
  87. //  End -->
  88. </script>
  89.  
  90.  
  91. <form name="eMailer">
  92. Tell a friend:
  93. <input type="text" name="email" size="26" value="     Enter Address Here" onFocus="this.value=''" onMouseOver="window.status='Enter email address here and tell a friend about this site...'; return true" onMouseOut="window.status='';return true">
  94. <br>
  95. <input type="button" value="Send this URL" onMouseOver="window.status='Click to send an email (with this page address) to a friend! Enter email address above...'; return true" onMouseOut="window.status='';return true" onClick="mailThisUrl();">
  96. </form>
  97. <!-- END OF SCRIPT -->
  98. <!/PREVIEW>
  99.  
  100. <!RELATED>NONE<!/RELATED>